package com.xioz.android;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.Texture;

/**
 * GameButton Class
 * used for buttons that have a texture and can be clicked
 * 
 * @author Zong Xiong
 */
public class GameButton extends GameObject{
	
/***************************************************
 * Fields
 ***************************************************/
	
	// stores texture for the button
	private TextureRegion buttonTexture;


/***************************************************
 * Public Methods
 ***************************************************/
	
	/**
	 * Default Constructor
	 * constructs a button with the corresponding image
	 * 
	 * @param atlas, texture containing button texture
	 * @param img_x, upper-left x position on atlas
	 * @param img_y, upper-left y position on atlas
	 * @param x, lower-left x position of button
	 * @param y, lower-left y position of button
	 * @param inWidth, width of button
	 * @param inHeight, height of button
	 */
	public GameButton(Texture atlas, int img_x, int img_y, float x, float y, float inWidth, float inHeight) {
		super(x, y, inWidth, inHeight);
		buttonTexture = new TextureRegion(atlas, img_x, img_y, inWidth, inHeight);
	}
	
	/**
	 * draw
	 * draws the button texture to the batch
	 * 
	 * @param batch, where to draw texture
	 */
	public void draw(SpriteBatch batch) {
		batch.draw(buttonTexture, position.x, position.y);
	}

	/**
	 * getTexture
	 * retrieves texture of button
	 * 
	 * @return texture of button
	 */
	public TextureRegion getTexture() {
		// TODO Auto-generated method stub
		return buttonTexture;
	}

}
